\chapter{Shell Programming}
shell: an interface to Unix/Linux system, often refered to the Unix system's command interpreter. Howerver, it's much more than a command interpreter, it is also a powerful programming language. Take Bourne shell for example, it's contains the following features:
\begin{itemize}
  \item Process control
  \item Variables
  \item Regular expressions
  \item Flow control
  \item Powerful input and output control
  \item Functions 
\end{itemize}

The Bourne Again Shell \newline
The Bourne Again Shell, \emph{bash}, was developed as part of GNU project and has replaced the Bourne Shell, \emph{sh}, for GNU-based systems like Linux.
\section{Initialization File Contents}
The file \framebox{\emph{/etc/profile}} is maintained by the system administrator and contains shell initialization information required by all users on a system.

The file \framebox{\emph{.profile}} is under you control. You can add as much shell customization information as you want to this file.
\subsection{Setting the Path}
\begin{lined}{8cm}
  \begin{verbatim}
PATH = /bin:/usr/bin
MANPATH = /usr/man:/usr/share/man
\end{verbatim}
\end{lined}
Each of the individual entries separated by the colon character, :, are directories.

\subsection{The Magic Line}
The \verb|#!/bin/sh| must be the first line of a shell script in order for \emph{sh} to be used to run the script.

Adding comments to a script is quite simple: add lines that start with the \verb|#| charater.
\section{Varibles}
The section shows how to 
\begin{itemize}
  \item{Create Varibles}
  \item{Delete Varibles}
\end{itemize}
\subsection{Define Varibles}
\verb|name = value|
In this exmaple, \emph{name} is the name of the varibles and \emph{value} is the value it should hold.
This type of the varibles is called Scalar varible. Another type is called Array varible that can hold multiple values.

Varible names, such as \emph{1, 2 or 11}, that start with numbers are reserved for use by the shell. You can use the value stored in these varibles, but you can't set the value yourself.
 
In order to use spaces, we need to quote the value. eg:\\
\begin{verbatim}
$ FRUIT = ``apple orange plum''
\end{verbatim}
\subsection{Access Varibles}
To access the value stored in a varible, prefix its name with the dollar sign \verb|$|. eg:
\begin{verbatim}
$ echo $FRUIT
\end{verbatim}
\subsection{Array Varibles}
\begin{verbatim}
name = (value1 \ldots valuen)
\end{verbatim}
Here, \emph{name} is the name of the array and the values, \emph{1} to \emph{n}, are the valuesof the items to be set. The array indices beginning at 0.

Accessing array varibles
\begin{verbatim}
$ echo {name[2]}
$ echo {name[*]}	#access all items in the array
$ echo {name[@]}
\end{verbatim}
\section{Unsetting Varibles}
Both scalar and array varibles are unsetting using \emph{unset} command. eg:\\
unset name
\section{Enviorment Variables}





